<%@ taglib uri="/struts-tags" prefix="s" %>


<%@page import="gcontent.Results.Result"%>
<div id="howmanyresults">
	<s:property value="NumRowsString"/>
</div>

<%
	gcontent.Results.Results res = (gcontent.Results.Results)request.getAttribute("results");
	if (res != null) {
%>
	<table id="resultImg" width="90%" align="center" border="0">
		<%
		boolean openTR = true;
		boolean closeTR = false;
		for (int i = 0; i < res.getCount(); i++)
		{
			if (res.getAt(i).isVisible()) {
				closeTR = (i > 0 && i % 5 == 0);
				
				if (closeTR) {
					%></tr><%
					openTR = true;
				}		
				
				if (openTR) {
					%><tr valign="top"><%
					openTR = false;
				}
				
				%>
				<td align="center" width="20%">
					<table width="100%" align="center">
						<tr valign="bottom">
							<td align="center" valign="top">
								<img alt="<%=res.getAt(i).getHost()%>" onclick="MoveToPage('<%=res.getAt(i).getPath() %>')" class="image_result" alt="result" src="<%=res.getAt(i).getPath() %>"/>
							</td>
						</tr>
						<tr valign="top">
							<td align="center" valign="bottom">
								<a Class="normal" href="http://<%=res.getAt(i).getHost() %>"><%=res.getAt(i).getHost()%></a>
							</td>
						</tr>
					</table>
				</td>
				<%
			}
		}
		if (closeTR) {
			%></tr><%			
		}
		%>
	</table>
	
	<br />	
	
		
<%
		if (res.getCount() > 0) {
			int current_page = (Integer)request.getAttribute("currentPage");
			int total_pages = (Integer)request.getAttribute("totalPages");		
					
			for (int i = 1; i <= total_pages; i++) {
				if (current_page == i - 1) {
					%> 
						<s:a cssClass="pagingRed" href="#"><%=i %></s:a>
					<%
				} else {
					
					String redirect_url = "Searcher?search=" + request.getParameter("search") + 
							"&dosearch=" + request.getParameter("dosearch") + "&searchType=" + 
							request.getParameter("searchType") + "&currentPage=" + (i-1);
					%>					
						<a onmousemove="javascript:;" onmouseover="javascript:;" class="paging" href="<%=redirect_url %>"><%=i %></a>					
					<%				
				}
			}
		}
	}
%>


<!-- 

<div id="search_row">	
	<div id="search_name" class="ResNonPair">refence</div>
	<div id="search_ref" class="ResNonPair"></div>
	<div id="search_name" class="ResNonPair">content</div>
	<div id="search_value" class="ResNonPair">edewdedew PALABRA adddaddd</div>
	<div id="search_name" class="ResNonPair">info</div>
	<div id="search_last_value" class="ResNonPair">date (1/12/2009 12:30:40), size (2 MB)</div>
</div>
<div id="search_row">	
	<div id="search_name" class="ResPair">refence</div>
	<div id="search_ref" class="ResPair">http://usuarios.tal.com/test.pdf</div>
	<div id="search_name" class="ResPair">content</div>
	<div id="search_value" class="ResPair">edewdedew PALABRA adddaddd</div>
	<div id="search_name" class="ResPair">info</div>
	<div id="search_last_value" class="ResPair">date (1/12/2009 12:30:40), size (2 MB)</div>
</div> -->